<template>
    <view class="container">
			<button @click="crop">裁切</button>
        <bt-cropper ref="cropper" imageSrc="https://img-cdn-aliyun.dcloud.net.cn/stream/plugin_screens/0e1e6eb0-439f-11ec-81a5-49bf31f2d415_0.png?image_process=quality,q_70/format,webp&v=1667451336"></bt-cropper>
        <button @click="crop">裁切</button>
    </view>
</template>
<script>
	export default {
	   methods:{
	      crop(){
					
	        // 通过组件定义的ref调用cropper方法，返回一个promise对象
	        this.$refs.cropper.crop().then(([err,res])=>{
	            
							console.log(err , res)
							if(!err){
	                console.log(res)
	            }else{
	                console.err(err)
	            }
	        })
	      }
	   }
	}
</script>
<style>
    .container{
        /** 外层一定要指定大小 */
        height:100vh;
    }
</style>


